import {getUserInfo} from "../api/my";
import identity from "./identity";

export default {
    mixins: [identity],
    data() {
        return {
        }
    },
    computed: {
        userInfo() {
            return this.$store.state.auth.userInfo
        },
    },
    onShow() {
        const getToken = () => this.$store.state.auth.token || uni.getStorageSync("token") || '';
        const token = getToken()
        if (token) {
            this.getUserInfoData()
        }
    },
    created() {

    },
    methods: {
        getUserInfoData() {
            getUserInfo({
                type: this.identityType
            }).then(res => {
                this.$store.commit('auth/SET_USERINFO_DATA', res.data)
            })
        },
    },
}